using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RollingBG : MonoBehaviour
{
    [SerializeField] private float dist;
    [SerializeField] private float moveSpeed;
    public bool roll=false;
    // Update is called once per frame
    void Update()
    {
        //transform.Translate(-transform.up * moveSpeed * Time.deltaTime);
        //if (transform.position.y <= -dist)
        //{
        //    transform.position = new Vector3(0,0,0);
        //}


        if (roll==false)
        {
            transform.Translate(-transform.up * moveSpeed * Time.deltaTime);
        }
        if (transform.position.y <= -dist) 
        {
            roll = true;
        }
        if (transform.position.y >=0f)
        {
            roll = false;
        }
        if (roll == true)
        {
            transform.Translate(transform.up * moveSpeed * Time.deltaTime);
        }

    }
}
